package com.library.service.impl;


import com.library.common.core.text.Convert;
import com.library.domain.BoIntegralConfig;
import com.library.mapper.BoIntegralConfigMapper;
import com.library.service.IBoIntegralConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 积分规则配置 服务层实现
 *
 * @author wanghongjie
 * @date 2020-01-18
 */
@Service
public class BoIntegralConfigServiceImpl implements IBoIntegralConfigService {
    @Autowired
    private BoIntegralConfigMapper boIntegralConfigMapper;

    /**
     * 查询积分规则配置信息
     *
     * @param id 积分规则配置ID
     * @return 积分规则配置信息
     */
    @Override
    public BoIntegralConfig selectBoIntegralConfigById(Long id) {
        return boIntegralConfigMapper.selectBoIntegralConfigById(id);
    }

    @Override
    public int selectBoIntegralConfigBySignNumber() {
        return boIntegralConfigMapper.selectBoIntegralConfigBySignNumber().getIntegralNum();
    }

    @Override
    public int selectBoIntegralConfigByActivityNumber() {
        return boIntegralConfigMapper.selectBoIntegralConfigByActivityNumber().getIntegralNum();
    }

    @Override
    public int selectBoIntegralConfigByOtherNumber() {
        return boIntegralConfigMapper.selectBoIntegralConfigByOtherNumber().getIntegralNum();
    }

    /**
     * 查询积分规则配置列表
     *
     * @param boIntegralConfig 积分规则配置信息
     * @return 积分规则配置集合
     */
    @Override
    public List<BoIntegralConfig> selectBoIntegralConfigList(BoIntegralConfig boIntegralConfig) {
        return boIntegralConfigMapper.selectBoIntegralConfigList(boIntegralConfig);
    }

    /**
     * 新增积分规则配置
     *
     * @param boIntegralConfig 积分规则配置信息
     * @return 结果
     */
    @Override
    public int insertBoIntegralConfig(BoIntegralConfig boIntegralConfig) {
        return boIntegralConfigMapper.insertBoIntegralConfig(boIntegralConfig);
    }

    /**
     * 修改积分规则配置
     *
     * @param boIntegralConfig 积分规则配置信息
     * @return 结果
     */
    @Override
    public int updateBoIntegralConfig(BoIntegralConfig boIntegralConfig) {
        return boIntegralConfigMapper.updateBoIntegralConfig(boIntegralConfig);
    }

    /**
     * 删除积分规则配置对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBoIntegralConfigByIds(Long[] ids) {
        return boIntegralConfigMapper.deleteBoIntegralConfigByIds(ids);
    }

}
